package com.boot2.core.scheduler;

import lombok.extern.apachecommons.CommonsLog;
import org.quartz.*;

/**
 * @author zhangweilin
 * @description:
 * @date 2018/6/7
 */
@CommonsLog
@PersistJobDataAfterExecution
@DisallowConcurrentExecution  //此为禁止并发,是否支持并发，可配置在数据库中，当加载到是否并发时，通过反射动态创建此类
public abstract class AbstractUnConcurrentJob implements Job,JobHandler {
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        //由子类执行，有逻辑在此补充
        run(jobExecutionContext);
    }

    protected void run(JobExecutionContext jobExecutionContext) {
        //将调度信息本身也实时入库
//        JobExecutionContextService jobExecutionContextService = SpringUtil.getBean(JobExecutionContextService.class);
//        jobExecutionContextService.saveJobExecutionContext(jobExecutionContext);
        hand(jobExecutionContext);
    }
}
